<!DOCTYPE html>
<html>

<head>
	<meta charset="utf-8">
	<title>请命名~</title>
</head>

<body>
	<script src="../js/jq.js"></script>
	<script>
		// var obj = "dfjoj减低23几点几分";
		// console.log(obj.match(/[\u4e00-\u9fa5]{1}/g))
		var arr = []

		var {resolve, reject} = new Promise((resolve, reject) => $.ajax({
			url: "http://140.143.27.23:8080/scan",
			success(data) {
				console.log("data:", data);
				arr[0] = data;
				resolve(data)
			},
			error() {
				console.log("error")
				reject("err")
			}
		}))
			.then(function (value) {
				// arr = value;
				// console.log('arr1', arr)
			})

		console.log('p', reject, resolve)

		var time = setInterval(() => {
			if (arr.length != 0) {
				clearInterval(time)
				console.log('arr2', arr)
			} else {
				console.log('3')
			}
		}, 1000);

	</script>
</body>

</html>